<?php
/* -------------------------------------
 *
 *  Quotes
 *
 *  @copyright: Anton Minakov
 *
 *  @author: Anton Minakov
 *  @email: maggotjb@gmail.com
 *
 *  this file should be load first
 *
 * --------------------------------------
*/

//phpinfo();die;

define("MAIN_DIR",dirname(__FILE__).DIRECTORY_SEPARATOR);

/**
 * core/defines.php
 * include all system and word constants and variables
*/
require_once MAIN_DIR.DIRECTORY_SEPARATOR."core".DIRECTORY_SEPARATOR."defines.php";

/**
 * core/settings.php
 * constain application settings
*/
require_once CORE."settings.php";

/**
 * core/functions.php
 * include needed functions
*/
require_once CORE."functions.php";

/**
 * core/functions.php
 * include needed classes
*/
require_once CORE."classes.php";

session_start();

/**
 * create instance of global objects
 * Router - class work with paths
 * MySQL - class work with mysql database
 * User - class work with current user
*/
$route = new Router();
$db = new MySQL(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);
$user = new User();

/**
 * include needed file
 */
switch ($route->getPath(1)) {
	
	case "":		require_once APP.MAINFILE; break;
	case "like":	require_once APP."like.php"; break;
	case "admin":	require_once ADMIN.MAINFILE; break;

	default:		require_once APP.MAINFILE;
}

?>